<template>
  <a-tree-select
      v-model="value"
      :disabled="isDisabled"
      style="width: 100%"
      :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
      :tree-data="treeData"
      placeholder="请选择父节点"
      :replaceFields="replaceFields"
  >
  </a-tree-select>
</template>

<script>
export default {
  name: "SelectTree",
  props:{
    treeData:{type:Array, default:()=>[]},
    replaceFields:{
      type:Object,
      default:()=>({
        children:'children',
        title:'title',
        key:'key',
        value: 'value'
      })},
    isDisabled:{
      type:Boolean,
      default:false
    }
  },
  data(){
    return {
      value:undefined,
    }
  },
  watch: {
    value(value) {
      console.log("SelectTree选择的值为",value);
      this.$emit('getSelectTreeValue',value)
    },
  }
}
</script>

<style scoped>

</style>
